package com.caigou.service.impl;

import com.caigou.bean.cms.entity.ArticleSpecialLayout;
import com.caigou.mapper.cms.ArticleSpecialLayoutMapper;
import com.caigou.pojo.ArticleSpecialLayoutData;
import com.caigou.service.ArticleSpecialLayoutService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ArticleSpecialLayoutServiceImpl implements ArticleSpecialLayoutService {

    @Resource
    private ArticleSpecialLayoutMapper articleSpecialLayoutMapper;

    @Override
    public ArticleSpecialLayout saveArticleSpecialLayoutData(String articleId, Integer specialType, Integer specialStatus) {
        ArticleSpecialLayout layout = new ArticleSpecialLayout();
        layout.setArticleId(articleId);
        layout.setSpecialType(specialType);
        layout.setSpecialStatus(specialStatus);
        articleSpecialLayoutMapper.saveArticleSpecialLayoutData(layout);
        return layout;
    }

    @Override
    public List<ArticleSpecialLayoutData> loadArticleSpecialLayoutData(String articleId) {
        return articleSpecialLayoutMapper.loadArticleSpecialLayoutData(articleId);
    }

    @Override
    public void deleteArticleSpecialLayout(String articleId) {
        articleSpecialLayoutMapper.deleteArticleSpecialLayout(articleId);
    }
}
